package yyy;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;


public class InputStreamReaderTest {

	public static void main(String[] args) throws Exception{
		BufferedReader br = null;
		try {
			FileInputStream fis = new FileInputStream("EncodeTest.txt");
			InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
			br = new BufferedReader(isr);
			String line = null;
			while((line=br.readLine())!=null)
				System.out.println(line);
		} finally{
			if (br!=null){
				br.close();
			}
		}
	}
	@SuppressWarnings("unused")
	//201521123103
	private static void convertGBK2UTF8(String src,String dst) throws IOException{
		BufferedReader in = null;
		OutputStreamWriter out = null;
		BufferedWriter out1 = null;
		try{
			in = new BufferedReader(new InputStreamReader(new FileInputStream(src),"UTF-8"));
			out = new OutputStreamWriter(new FileOutputStream(dst),"UTF-8");
			out1 = new BufferedWriter(out);
			String line = null;
			while((line=in.readLine())!=null){
				out1.write(line);
				out1.newLine();
			}
			
		} finally{
			if (in!=null){
				in.close();
				out1.close();
			}
		}
	}
}